package com.gitee.zhanyao.servera.controller;

import com.gitee.zhanyao.api.security.model.OAuth2User;
import com.gitee.zhanyao.api.security.model.OAuth2UserDTO;
import com.gitee.zhanyao.servera.client.UserClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class HelloController {

    @Autowired
    private UserClient userClient;

    @GetMapping("/hello")
    public String helloWorld() {
        OAuth2UserDTO oAuth2User = userClient.currentUser();
        log.info(oAuth2User.toString());
        return "Hello World !";
    }

    @GetMapping("/hi")
    public String hi() {
        return "Hi !";
    }

}
